import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Translator {
    private Map<String, String> dictionary = new HashMap<>();

    public Translator() {
        dictionary.put("你好", "Hello");
        dictionary.put("再见", "Goodbye");
    }

    public String translate(String input) {
        if (dictionary.containsKey(input)) {
            return dictionary.get(input);
        } else if (dictionary.containsValue(input)) {
            for (Map.Entry<String, String> entry : dictionary.entrySet()) {
                if (entry.getValue().equals(input)) {
                    return entry.getKey();
                }
            }
        }
        return "抱歉，我无法翻译这个词汇。";
    }

    public static void main(String[] args) {
        Translator translator = new Translator();
        Scanner scanner = new Scanner(System.in);

        System.out.println("输入要翻译的词汇（输入'exit'退出）：");
        while (true) {
            String input = scanner.nextLine();
            if ("exit".equalsIgnoreCase(input)) {
                break;
            }
            String translation = translator.translate(input);
            System.out.println(translation);
        }

        scanner.close();
    }
}
